package kassiopeia.plugin;

import java.io.File;
import java.util.List;

public interface Context {

    /**
     * Parameters are the way to pass relevant information to plugin which
     * can control its behavior.
     *
     * Parameters are assigned to plugin  in plugin descriptor (default values) and task descriptor.
     *
     * @param key Parameter key
     * @return Parameter value
     */
    String getParameter(String key);

    /**
     * Class loader which loaded plugin's class.
     *
     * Each plugin has its own class loader and here you can find it.
     *
     * @return {@link ClassLoader} for this plugin's class
     */
    ClassLoader getClassLoader();

    String getThisAgentId();
    List<String> getOtherAgentsIds();

    /**
     * Each plugin has its own uniquely assigned instance identifier which differs him
     * from other plugins.
     *
     * This identifier is assigned by task author and must be unique within task.
     *
     * Here you can obtain it.
     *
     * @return Plugin instance identifier
     */
    String getPluginInstanceId();

    File getTemporaryDirectory();

    /**
     * Sends event to plugin output
     *
     * @param event Event to send
     * @param outputId Plugin output identifier
     * @throws IllegalArgumentException when there is no output with such identifier
     */
    void send(Event event, String outputId);

    void sendLocally(Event event, String outputId);

    Logger getLogger();

    void alert(String message);
}
